import request from "@/utils/request";
import { MemberForm, MemberQuery } from "./types";

const baseUri = "/mv1/api/member";

/**
 * 获取用户分页列表
 *
 * @param queryParams
 */

export function getMemberList(query: MemberQuery) {
  /*
export function getMemberList(
  queryParams: MemberQuery
): AxiosPromise<PageResult<MemberPageVO[]>> {*/
  return request({
    url: baseUri + "/",
    method: "get",
    params: query,
  });
}

/**
 * 获取用户表单详情
 *
 * @param userId
 */
export function getMemberForm(userId: number) {
  return request({
    url: baseUri + "/detail/" + userId,
    method: "get",
  });
}

/**
 * 修改用户
 *
 * @param id
 * @param data
 */
export function updateMember(id: number, data: MemberForm) {
  return request({
    url: baseUri + "/edit/" + id,
    method: "put",
    data: data,
  });
}

/**
 * 修改用户
 *
 * @param id
 * @param data
 */
export function updateIntegral(id: number, data: MemberForm) {
  return request({
    url: baseUri + "/integral/" + id,
    method: "put",
    data: data,
  });
}

/**
 * 删除用户
 *
 * @param ids
 */
export function deleteMember(id: number) {
  return request({
    url: baseUri + "/" + id,
    method: "delete",
  });
}
